package com.sh.粘包半粘包.one;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost", 8888);
        OutputStream outputStream = socket.getOutputStream();

        // 发送两个消息，可能会出现粘包或半包问题
        outputStream.write("Hello".getBytes());
        outputStream.write("World".getBytes());


        outputStream.write("Hello".getBytes());
        outputStream.write("World".getBytes());


        outputStream.write("Hello".getBytes());
        outputStream.write("World".getBytes());

//        socket.close();
    }
}